import { defineStore } from 'pinia'
import {ref ,computed} from 'vue'
export const useCounterStore = defineStore('counter', () => {
  const lb=ref([])
    function add(payload){
      const index=lb.value.findIndex(item=>item.id==payload.id)
        
        if(index>-1){
            lb.value[index].count++
        }else {
            lb.value.push({
                ...payload,
                count:1,
                checked:false,
            })
        }
    }
  
    return {lb ,add }
  })
